﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter4.Section2
{
    public class Example05
    {
        public Example05()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double, double[]> f
                = new V.Function.ToLastType<double, double[]>(func);
            V.Path p = new V.Path(f);
            V.ArcLength al = new V.ArcLength(p, 0.0, Math.PI);
            al.Compute();
            result += al.Result.ToString() + "\r\n";
            double ans = Math.Sqrt(5.0) * Math.PI;
            result += ans.ToString() + "\r\n";
        }
        private double[] func(double t)
        {
            double[] c = new double[4];
            c[0] = Math.Cos(t);
            c[1] = Math.Sin(t);
            c[2] = Math.Cos(2.0*t);
            c[3] = Math.Sin(2.0*t);
            return c;
        }
    }
}

// 7.02481473104001
// 7.02481473104073
